^SIMULATED DATA FOR PAIRS OF CLUSTERS^

This file contains simulated data for 50 pairs of clusters, each comprised of
20 individuals, with data summarised at the cluster level, resulting in 100
lines of data. Normally-distributed random effects for cluster and pair levels
are added to the linear predictor in a logistic model.

Variables used for analysis:

   ^cid^           cluster identification number
   ^pr^            identifier to designate matched pairs
   ^interv^        treatment variable: 0=control, 1=intervention
   ^binresp^       mean of a cluster's 20 Bernoulli responses

^References^

Hayes RJ, Moulton LH. ^Cluster Randomised Trials, 2nd Edition.^  Chapman & Hall/CRC 2017;
Boca Raton, FL.

 * GENERATING SAS CODE------------------------------------------------------- ;
 data simpairs;
  rndseed=12327; 
  sgma1=.5;  * for generation of pair effects ;
  sgma2=.25; * for generation of cluster effects;
  csiz=20;   * sample size per cluster;
  nclus= 50; * number of clusters each arm;
  b0=-1;     *intercept;
  b1=-0.5;   *intervention effect; 
    		 
   * pair loop;
      pr=0; do while (pr< nclus ); pr=pr+1;
      ranpr =sgma1*rannor(rndseed);  * random effect for each pair;

    *arm loop;
       arm=0; do while (arm<2); arm=arm+1;
       interv=(2-arm); * dummy for intervention ;

       raneff= sgma2*rannor(rndseed);  * random effect for each cluster;
       cid=1000*arm+pr;  * unique id for each cluster;
 
	* generate binomial response for a cluster;
       expited= b0+b1*interv+ranpr+raneff;
       pi=exp(expited)/(1+exp(expited));      
       binresp=ranbin(rndseed,csiz,pi);

	output;

    end;  * end arm;
   end;  * end pair;
